package org.vacoor.ticket.handler.impl.option;

import java.io.UnsupportedEncodingException;

import org.vacoor.ticket.Constant;
import org.vacoor.ticket.handler.ResultHandler;
import org.vacoor.ticket.util.ParseUtil;

/**
 * 订单确认提交后的处理
 * @author vacoor
 *
 */
public class SubmitOrderResultHandler implements ResultHandler<String>{

	//{"errMsg":"Y"} 正常
	//{"errMsg":"非法的订票请求！"} 错误
	//{"errMsg":"验证码 必须输入."}
	//{"errMsg":"后台处理异常！"}
	//非法请求
	//重复提交
	//未付款订单
	//包含排队中 //您有排队中订单! 点确定转到排队页面
	//排队人数现已超过余票数
	@Override
	public String handler(byte[] content) {
		String result;
		try {
			result = new String(content,Constant.ENCODING);
		} catch (UnsupportedEncodingException e1) {
			// TODO Auto-generated catch block
			e1.printStackTrace();
			result = new String(content);
		}
		return ParseUtil.getValueFromJsonStr("errMsg", result);
	}

}
